using System;
using UnityEngine;

namespace JH
{
    public class TestTextTranslation : MonoBehaviour
    {
        [SerializeField] private string origin;

        private void Awake()
        {
            TestTranslate();
        }

        [ContextMenu("测试翻译为中文")]
        private async void TestTranslate()
        {
            if (string.IsNullOrEmpty(origin))
            {
                Debug.LogError("请输入需要翻译的内容！");
                return;
            }

            await TextTranslationHelper.TranslateToEn(origin, result => { Debug.Log($"翻译结果：{result}"); });
        }

        [ContextMenu("测试翻译为英文")]
        private async void TestTranslateToEn()
        {
            if (string.IsNullOrEmpty(origin))
            {
                Debug.LogError("请输入需要翻译的内容！");
                return;
            }

            await TextTranslationHelper.TranslateToEn(origin, result => { Debug.Log($"翻译结果：{result}"); });
        }
    }
}